<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 计算两个数的和
    function calculateSum(num1 = 0, num2 = 0) {
      // while (true) {
      // let num1 = parseFloat(prompt("请输入第一个数："));

      // let num2 = parseFloat(prompt("请输入第二个数："));

      alert("两个数的和为：" + (num1 + num2));
      // }
    };
    // calculateSum(num1 = parseFloat(prompt("请输入第一个数：")), num2 = parseFloat(prompt("请输入第二个数：")));
    let num1 = parseFloat(prompt("请输入第一个数："));
    let num2 = parseFloat(prompt("请输入第二个数："));
    calculateSum(num1, num2);
  </script>
</body>

</html>